﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 8/27/2009
 * Time: 9:54 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using Miming.Model;

namespace Miming.Gui
{
	/// <summary>
	/// Description of BillingRateLevelForm.
	/// </summary>
	public partial class BillingRateLevelForm : BaseForm
	{
		public BillingRateLevelForm() : this(new BillingRateLevel())
		{
			
		}
		
		public BillingRateLevelForm(BillingRateLevel l)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			Model = l;
		}
		
		protected override void OnModelChanged(EventArgs e)
		{
			base.OnModelChanged(e);
			BillingRateLevel l = Model as BillingRateLevel;
			textBoxName.Text = l.Name;
			checkBoxInactive.Checked = l.Inactive;
		}
		
		void ButtonOkClick(object sender, EventArgs e)
		{
			BillingRateLevel l = Model as BillingRateLevel;
			l.Name = textBoxName.Text;
			l.Inactive = checkBoxInactive.Checked;
			SessionFacade.SaveOrUpdateBillingRateLevel(l);
			Close();
		}
		
		void ButtonCancelClick(object sender, EventArgs e)
		{
			Close();
		}
	}
}
